from collections import deque


# python 实现相关的队列的方式
class Node:
    def __init__(self,data):
        self.data=data
        self.next=None

class Queue:

    def __init__(self):
        self.rear=None
        self.front=None
        self.r=0
        self.f=0

    def isEMpty(self):
        if self.r==self.f:
            print("The queue is empty")
        else:
            print("The queue is not empty")

    def dequeue(self,data):
        if self.f==self.r:
            q=Node(data)
            self.rear=q
            self.front=q
            self.r=0
            self.f=1
        else:
            q=Node(data)
            self.rear.next=q
            self.rear=q
            self.f+=1

    def enqueue(self):
        if self.r==self.f:
            print("The Queue is empty")
            #return false
        else:
            self.front=self.front.next
            self.f=self.f-1

    def top(self):
        if self.r==self.f:
            print("empty")
        else:
            print(self.front.data)

if __name__ == '__main__':
    queue = Queue()
    queue.dequeue(123)
    print(queue.top())
    queue.enqueue()
    print(queue.top())